using System.ComponentModel.DataAnnotations;

namespace KnowledgeQA.Models.Entities
{
    /// <summary>
    /// 聊天会话实体类
    /// </summary>
    public class ChatSession : BaseEntity
    {
        /// <summary>
        /// 会话标题
        /// </summary>
        [Required]
        [MaxLength(200)]
        public string Title { get; set; } = string.Empty;

        /// <summary>
        /// 会话描述
        /// </summary>
        [MaxLength(500)]
        public string? Description { get; set; }

        /// <summary>
        /// 用户ID
        /// </summary>
        [MaxLength(100)]
        public string? UserId { get; set; }

        /// <summary>
        /// 会话状态（Active、Archived、Deleted）
        /// </summary>
        [MaxLength(20)]
        public string Status { get; set; } = "Active";

        /// <summary>
        /// 使用的模型名称
        /// </summary>
        [MaxLength(100)]
        public string? ModelName { get; set; }

        /// <summary>
        /// 会话配置（JSON格式存储）
        /// </summary>
        [MaxLength(2000)]
        public string? Configuration { get; set; }

        /// <summary>
        /// 消息列表
        /// </summary>
        public virtual ICollection<ChatMessage> Messages { get; set; } = new List<ChatMessage>();

        /// <summary>
        /// 最后活跃时间
        /// </summary>
        public DateTime LastActiveAt { get; set; } = DateTime.Now;

        /// <summary>
        /// 消息数量
        /// </summary>
        public int MessageCount { get; set; } = 0;
    }
} 